package com.cheng.student.controller.filter;

import javax.servlet.*;
import javax.servlet.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

@WebFilter(urlPatterns = "/*")
public class CharSetFilter
        implements Filter
{
    public void init(FilterConfig config)
            throws ServletException
    {
    }

    public void destroy()
    {
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
            throws ServletException, IOException
    {
        response.setContentType("text/html;charset=UTF-8");
        chain.doFilter(request, response);
    }
}
